#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author:Taotie Ren
# import logging 
# 禁用日志模块
# logging.disable(logging.CRITICAL)
# logging.basicConfig(level=logging.DEBUG, format=' %(asctime)s - %(levelname)s - %(message)s')

# stopWatch.py - A simple stopwatch program.
import time

# Display the program~s instructions.
print('Press ENTER to begin, Afterwards, press ENTER to "click" the stopwatch. Press Ctrl + C to quit. ')
input()     # press ENTER to begin.
print('Started.')
startTime = time.time()     # get the first lap`s start time.
lastTime = startTime
lapNum = 1

# Start tracking the lap times.
try:
	while True:
		input()
		lapTime = round(time.time() - lastTime, 2)
		totalTime = round(time.time() - startTime, 2)
		print('Lap #%s: %s (%s)' % (lapNum, totalTime, lapTime), end=' ')
		lapNum += 1
		lastTime = time.time()      # reset the last lap time.
except KeyboardInterrupt:
	# Handle the Ctrl + C  exception to keep its error message from dispalying.
	print('\nDone,')
